package com.example.androidmqtt.Mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.androidmqtt.Entry.User;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author: pjg
 * @time: 2022/9/13
 */
@Mapper
public interface UserMapper extends BaseMapper<User> {


    @Delete("delete from user where user_id=#{userId};" +
            "delete from subscribe where sub_user=#{userId};" +
            "delete from news where news_author=#{userId}")
    int DeleteUser(Integer userId);

    @Select("select user_department from user where user_id=#{userId}")
    int getDepartment(int userId);

    @Select("select user_avatar from user where user_id=#{userId}")
    String getUserAvatar(Integer userId);
}
